package org.snail.dept.bean;

import com.dingtalk.open.client.api.model.corp.CorpUser;
import com.dingtalk.open.client.api.model.corp.Department;
import lombok.Data;
import org.snail.employee.bean.EmployeesDO;

import java.util.Date;
import java.util.List;
import java.util.Objects;

@Data
public class DepartDO {
    private Long id;
    private String name;
    private String userid;
    private String chatId;   //钉钉群组中chatId
    private String managers;   //部门管理员
    private Long parentid;
    private Integer deptUserId;    //部门人员关联表的ID
    private Integer deptStatus;    //部门状态
    private int isDel;    //是否删除
    private List<CorpUser> userIds;
    private List<DeptUserDO> addUserList;    //需要新增的人员
    private List<DeptUserDO> delUserList;      //需要删除的人员
    private List<Department> departmentList;
    private List<EmployeesDO> employeesDOList;   //人员信息
    private Date updateTime;    //数据修改时间
    private Date createTime;    //数据新增时间

    @Override
    public boolean equals(Object object) {
        if (this == object) return true;
        if (!(object instanceof DepartDO)) return false;
        //if (!super.equals(object)) return false;   //内存中的地址值
        DepartDO departDO = (DepartDO) object;
        return Objects.equals(id, departDO.id) && Objects.equals(name, departDO.name) && Objects.equals(parentid, departDO.parentid);
    }

    @Override
    public int hashCode() {
        int hashCode = -1;
        if(null!=id) {
            hashCode = id.hashCode();
        } else if(null!=userid) {
            hashCode = userid.hashCode();
        }
        return hashCode;
    }

    @Override
    public String toString() {
        return "DepartDO{" +
                "id=" + id +
                ", name='" + name + '\'' +
                ", userid='" + userid + '\'' +
                ", chatId='" + chatId + '\'' +
                ", managers='" + managers + '\'' +
                ", parentid=" + parentid +
                ", deptUserId=" + deptUserId +
                ", deptStatus=" + deptStatus +
                ", isDel=" + isDel +
                ", userIds=" + userIds +
                ", addUserList=" + addUserList +
                ", delUserList=" + delUserList +
                ", departmentList=" + departmentList +
                ", employeesDOList=" + employeesDOList +
                ", updateTime=" + updateTime +
                ", createTime=" + createTime +
                '}';
    }
}
